package TreeHole.patches;

import TreeHole.mod.TreeHoleBase;
import TreeHole.mod.TreeHoleHelper;
import TreeHole.save.SaveAndContinueFore;
import TreeHole.save.TreeHoleSave;
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.evacipated.cardcrawl.modthespire.lib.SpirePostfixPatch;
import com.evacipated.cardcrawl.modthespire.lib.SpirePrefixPatch;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;

public class TreeHoldScorePatch {
    //由于删档早于结算分数
    @SpirePatch(clz = AbstractDungeon.class,method = "reset")
    public static class ResetPatch {
        @SpirePrefixPatch
        public static void Prefix() {
            if(true)
                return;
            AbstractPlayer p = AbstractDungeon.player;
            //all mods delete
            for(TreeHoleBase base:TreeHoleHelper.getAllBases()){
                if(base.getSaveClass()!=null){
                    TreeHoleSave ts = SaveAndContinueFore.loadTreeHole(p.chosenClass,base.getSaveClass());
                    if(ts!=null){
                        ts.onReset();
                    }
                    SaveAndContinueFore.deleteTreeHole(p.chosenClass,base.getSaveClass());
                }
            }
        }
    }
}
